GBML manual / Constants

TEXT_DRUM

A lens fixed to the middle of the screen, and the words slide through it: full size in the middle, narrower and shorter toward the top and bottom of the lens, gone at its edge - like words printed on a drum that is rolling past you. Move the word up or down and it rolls. depth is how tight the lens is: 1 is as tall as the screen, 6 is tight.

Works differently on Game Boy - The Game Boy shows a TEXT_DRUM text only while its middle is inside the lens, whole and at full width: it does not narrow toward the edge of the lens (24 letters at most, drawn with sprites).

Works differently on Game Boy Color - The Game Boy Color shows a TEXT_DRUM text only while its middle is inside the lens, whole and at full width: it does not narrow toward the edge of the lens (24 letters at most, drawn with sprites).

Sega Genesis: not built yet

On other consoles this differs: see Side by side and How the consoles differ.

Syntax

TEXT_DRUM: constant

Description

Names the drum, a shape for draw_text_3d and draw_text_3d_anchored (and its scaled form, draw_text_3d_scaled). The other three shapes put the curve on the words, and it goes wherever the words go. The drum puts it on the screen: there is a lens in the middle of the picture, and words slide through it. A word in the middle row is full size and perfectly flat. As it slides up or down it gets narrower and shorter, and at the edge of the lens it closes up to nothing - like words printed on a drum that is rolling past you.

A real capture, nine frames that play one after another - the words STAGE 2 sliding down the screen through a lens in its middle. At the top they are a row of tiny letters that grow as they come down, they are full size and flat in the middle, and they shrink away again toward the bottomA real capture, nine frames that play one after another - the words STAGE 2 sliding down the screen through a lens in its middle. At the top they are a row of tiny letters that grow as they come down, they are full size and flat in the middle, and they shrink away again toward the bottom
A real capture, nine frames that play one after another - the words STAGE 2 sliding down the screen through a lens in its middle. At the top they are a row of tiny letters that grow as they come down, they are full size and flat in the middle, and they shrink away again toward the bottom

The same call every frame, with only y changing: the word rolls down through the lens. Nine real pictures, played in a loop. The picture is real; the movement is the point, so a viewer that does not play it shows only the first frame.

So the thing you animate is the word's own y. Draw it low and move it up and it rises out of the floor, growing as it comes; park it at the middle row (80 on the 160 pixel screen) and it stands there looking completely ordinary; push it on and it dwindles away over the top. That is what makes it good for a title that arrives, a round or level name, a word that slams in or recedes into the distance as a scene begins.

A real capture - six pictures of the words STAGE 2 at six heights on the screen, from near the top to below the middle. Near the top the letters are small and squashed, and they grow as the word gets nearer the middle rowA real capture - six pictures of the words STAGE 2 at six heights on the screen, from near the top to below the middle. Near the top the letters are small and squashed, and they grow as the word gets nearer the middle row
A real capture - six pictures of the words STAGE 2 at six heights on the screen, from near the top to below the middle. Near the top the letters are small and squashed, and they grow as the word gets nearer the middle row

Six frames of the roll, the word's row written under each (row 80 is the middle).

The words go through the lens like this: a row that is far from the middle is drawn smaller than one near the middle, and the size falls off as the square of the distance, so it is nearly full size for a good way either side of the middle and then drops away quickly toward the edge. The table is made for you.

Depth: how tight the lens is

depth is a whole number from 1 to 6 and it sets how tall the lens is, in rows above and below the middle of the screen:

depththe lens reacheswhat it is like
1100 rows each waytaller than the screen: a word is only squashed a little near the top and the bottom
284 rows
372 rowsa word is clearly smaller by the time it is half way to the edge
462 rows
554 rows
646 rowsa tight lens: a word is full size only close to the middle and has closed up well before the edge of the screen
A real capture - the words STAGE 2 held 34 rows below the middle of the screen while the lens gets tighter, from depth 1 to depth 6. The same word gets smaller and smaller because it is farther and farther toward the edge of the lensA real capture - the words STAGE 2 held 34 rows below the middle of the screen while the lens gets tighter, from depth 1 to depth 6. The same word gets smaller and smaller because it is farther and farther toward the edge of the lens
A real capture - the words STAGE 2 held 34 rows below the middle of the screen while the lens gets tighter, from depth 1 to depth 6. The same word gets smaller and smaller because it is farther and farther toward the edge of the lens

The same word, held in one place 34 rows below the middle, at each depth. The word has not moved: the lens has.

A number outside 1 to 6 is held to the nearest end, and 0 draws plain, flat text (and costs nothing), exactly as it does for the other shapes.

What to know before you use it

Example

text_align(ALIGN_CENTER);
draw_text_3d(120, 80 + wave(-70, 70, 180, 0), "STAGE 2", TEXT_DRUM, 3);

A word that rolls up and down the middle of the screen over and over (one trip up and back every three seconds), shrinking as it goes toward either edge of the lens.

text_align(ALIGN_CENTER);
draw_text_3d(120, 80, "STAGE 2", TEXT_DRUM, 3);

The same word standing still in the middle row, where the lens does nothing to it: plain, full size. Change the 80 and it rolls away from the middle.

See also: draw_text_3ddraw_text_3d_anchoreddraw_sprite_ripplescreen_backdrop